/**
 *
 */
package com.test.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.test.domain.User;
import com.test.service.UserService;
import com.test.service.impl.UserServiceImpl;

/**
 * @author Administrator
 * @date 2018年5月27日 下午3:24:39
 * 
 */
@WebServlet("/user")
public class UserServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		PrintWriter print = resp.getWriter();
		resp.setCharacterEncoding("utf-8");
		UserService userService = new UserServiceImpl();
		
		
		User user = new User();
		user.setName(req.getParameter("name"));
		List<User> lists = userService.query(user);
		print.write(lists.toString());
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		super.doPost(req, resp);
	}

	
	
}
